<template>
  <div class="log-list">
    <el-form ref="form" class="form-box" :model="form" label-width="80px">
      <el-form-item class="pick-file" label="选择文件:">
        <el-input v-model="form.scr" placeholder="请输入内容" class="input-with-select">
          <el-button slot="append" icon="el-icon-search" @click="pickFile">pick</el-button>
        </el-input>
      </el-form-item>
      <el-form-item label="时间段:">
        <el-date-picker
          v-model="form.date"
          type="datetimerange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        />
      </el-form-item>
      <el-form-item label="日志类型:">
        <el-checkbox-group v-model="form.type">
          <el-checkbox-button label="log1" name="type" />
          <el-checkbox-button label="log2" name="type" />
          <el-checkbox-button label="log3" name="type" />
          <el-checkbox-button label="log4" name="type" />
          <el-checkbox-button label="log5" name="type" />
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="日志模块:">
        <el-checkbox-group v-model="form.module">
          <el-checkbox-button label="module1" name="module" />
          <el-checkbox-button label="module2" name="module" />
          <el-checkbox-button label="module3" name="module" />
          <el-checkbox-button label="module4" name="module" />
          <el-checkbox-button label="module5" name="module" />
        </el-checkbox-group>
      </el-form-item>
      <el-form-item size="large">
        <el-button type="primary" @click="onSubmit">查询</el-button>
        <el-button>清空</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="tableData"
      style="width: 100%"
      :default-sort="{prop: 'date', order: 'descending'}"
    >
      <el-table-column prop="time" label="时间" sortable />
      <el-table-column prop="type" label="类型" width="80" />
      <el-table-column prop="module" label="模块" />
      <el-table-column prop="log" label="日志详情" width="200" />
      <el-table-column prop="class_name" label="类和行数" />
      <el-table-column prop="class_line" label="class_line" width="150" />
      <el-table-column prop="origin_log_line" label="origin_log_line" width="150" />
    </el-table>
    <el-pagination
      class="pagination"
      :current-page="currentPage"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script>
export default {
  name: 'LogList',
  props: {
    msg: String
  },
  data() {
    return {
      form: {
        src: '',
        date: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
        type: [],
        module: []
      },
      tableData: [
        {
          time: '2023-03-01',
          type: 'INFO',
          module: '资讯模块',
          log: 'zero-knowledge-range-proof',
          class_name: 'class_name',
          class_line: 'class_line',
          origin_log_line: 'origin_log_line'
        },
        {
          time: '2023-03-02',
          type: 'INFO',
          module: '资讯模块',
          log: 'this is zero proof',
          class_name: 'class_name',
          class_line: 'class_line',
          origin_log_line: 'origin_log_line'
        }
      ],
      currentPage: 1,
      pageSize: 10,
      total: 2

    }
  },
  methods: {
    onSubmit() {
      console.log('submit!')
    },
    pickFile() {
      alert('请选择文件！')
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    }
  }

}
</script>

<style scoped>
.log-list {
  padding:80px;
  position: relative;
}
.pick-file {
  width: 600px;
}
.pagination {
  margin-top: 20px;
  position: absolute;
  right: 80px;
}
</style>
